package com.chengh.nami.web.controller.error;

import com.chengh.nami.common.response.R;
import com.chengh.nami.common.response.ResponseCodeEnum;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 错误controller
 *
 * @author chengh
 */
@RestController
public class FilterErrorController {

    @RequestMapping(value = "/401")
    public Object notLogin(HttpServletRequest request) {
        // 取出错误信息
        String errorMsg = (String) request.getAttribute("errorMsg");
        return R.failed(ResponseCodeEnum.ERROR.getCode(), errorMsg);
    }

}
